home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / destroyer_alien_scripts.lua < prev    next >
Encoding:
Text File  |  2006-08-31  |  6.1 KB  |  155 lines

  1.  
  2. function units_destroyer_alien_setup()
  3.     units_setup_sea(5,true,true,ENET_EFFECT_GEOMETRY_TORPEDOSHIPALIENSHADOW)
  4. end
  5.  
  6. function units_destroyer_alien_resetup()
  7.     units_setup_sea(5,true,false,ENET_EFFECT_GEOMETRY_TORPEDOSHIPALIENSHADOW)
  8. end
  9.  
  10. function units_destroyer_alien_select()
  11.     units_select(17,2)
  12. end
  13.  
  14. function units_destroyer_alien_unselect()
  15.     units_unselect()
  16. end
  17.  
  18. function units_destroyer_alien_selectenemy()
  19.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
  20. end
  21.  
  22. function units_destroyer_alien_damaged()
  23.     uniGetExecutor():applyDamage(uniGetLife())
  24. end
  25.  
  26. function units_destroyer_alien_highlight()
  27.     uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
  28. end
  29.  
  30. function units_destroyer_alien_explode()
  31.     units_explode_water3()
  32. end
  33.  
  34. function units_destroyer_alien_move()
  35.     local unit = uniGetExecutor()
  36.     local sound = unit:play3DSound("destroyer_alien_move.wav",1)
  37.     local steps = unit:addSimpleEffect(ENET_EFFECT_EFFECTEMITTER_SHIP_WATERTRAY)
  38.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 0.7))
  39.     waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,80))
  40.     steps:suspendedDestroy(2.0)
  41.     sound:destroy()
  42. end
  43.  
  44. function units_destroyer_alien_fire1()
  45.     local unit = uniGetExecutor()
  46.     uniSetLife(uniGetLife() / 4.0)
  47.     local gt = unit:getBone(ENBT_GUNTOWER)
  48.     local sound = gt:play3DSound("destroyer_alien_guntower_rotate.wav",1)
  49.     waitDeath(gt:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERTOTARGET,MATH_PI,uniGetTarget()))
  50.     sound:stopSound()
  51.     pause(0.3)
  52.     gt:getBone(ENBT_FIRE1,0):addBulletEffect(ENET_EFFECT_BULLET_REDLASERBOLT):executeCommand(ENC_FIRE1)
  53.     pause(0.25)
  54.     gt:getBone(ENBT_FIRE1,1):addBulletEffect(ENET_EFFECT_BULLET_REDLASERBOLT):executeCommand(ENC_FIRE1)
  55.     pause(0.25)
  56.     gt:getBone(ENBT_FIRE1,0):addBulletEffect(ENET_EFFECT_BULLET_REDLASERBOLT):executeCommand(ENC_FIRE1)
  57.     pause(0.25)
  58.     gt:getBone(ENBT_FIRE1,1):addBulletEffect(ENET_EFFECT_BULLET_REDLASERBOLT):executeCommand(ENC_FIRE1)
  59.     unit:addFireArrow()
  60. end
  61.  
  62. function units_destroyer_alien_fire2()
  63.     local unit = uniGetExecutor()
  64.     uniSetLife(uniGetLife() / 2.0)
  65.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 0.7,uniGetTarget()))
  66.     local gn = unit:getBone(ENBT_GUNNEST)
  67.     pause(0.3)
  68.     gn:getBone(ENBT_FIRE2,0):addBulletEffect(ENET_EFFECT_BULLET_ALIENTORPEDO):executeCommand(ENC_FIRE1)
  69.     pause(1.0)
  70.     gn:getBone(ENBT_FIRE2,1):addBulletEffect(ENET_EFFECT_BULLET_ALIENTORPEDO):executeCommand(ENC_FIRE1)
  71.     unit:addFireArrow()
  72. end
  73.  
  74. registerCommand(ENSCRIPTSET_TORPEDOSHIP_ALIEN,ENC_MOVE,"units_destroyer_alien_move")
  75. registerCommand(ENSCRIPTSET_TORPEDOSHIP_ALIEN,ENC_FIRE1,"units_destroyer_alien_fire1")
  76. registerCommand(ENSCRIPTSET_TORPEDOSHIP_ALIEN,ENC_FIRE2,"units_destroyer_alien_fire2")
  77. registerCommand(ENSCRIPTSET_TORPEDOSHIP_ALIEN,ENC_SELECT,"units_destroyer_alien_select")
  78. registerCommand(ENSCRIPTSET_TORPEDOSHIP_ALIEN,ENC_SELECTENEMY,"units_destroyer_alien_selectenemy")
  79. registerCommand(ENSCRIPTSET_TORPEDOSHIP_ALIEN,ENC_UNSELECT,"units_destroyer_alien_unselect")
  80. registerCommand(ENSCRIPTSET_TORPEDOSHIP_ALIEN,ENC_SETUP,"units_destroyer_alien_setup")
  81. registerCommand(ENSCRIPTSET_TORPEDOSHIP_ALIEN,ENC_RESETUP,"units_destroyer_alien_resetup")
  82. registerCommand(ENSCRIPTSET_TORPEDOSHIP_ALIEN,ENC_DAMAGED,"units_destroyer_alien_damaged")
  83. registerCommand(ENSCRIPTSET_TORPEDOSHIP_ALIEN,ENC_EXPLODE,"units_destroyer_alien_explode")
  84. registerCommand(ENSCRIPTSET_TORPEDOSHIP_ALIEN,ENC_HIGHLIGHT,"units_destroyer_alien_highlight")
  85.  
  86. -- make description of unit
  87. desc = getEffectDescriptionP(ENET_UNIT_TORPEDOSHIP_ALIEN)
  88. desc.ClassID = ENCLASS_MESHINSTANCE
  89. desc.EffectClassType = ENECT_GEOMETRY
  90. desc.FileName = "torpedoship_alien.rmd"
  91. desc.ScriptSet = ENSCRIPTSET_TORPEDOSHIP_ALIEN
  92. desc.MoveType = ENMOVE_SWIM
  93. desc.RenderType = ENRENDERTYPE_GEOMETRY
  94. desc.Material = ENMAT_RIGIDSKINNEDMESH
  95. desc.MaterialColors = units_materialcolors_human
  96.  
  97. -- shadow
  98. desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_TORPEDOSHIPALIENSHADOW)
  99. desc.ClassID = ENCLASS_MESHINSTANCE
  100. desc.EffectClassType = ENECT_GEOMETRY
  101. desc.FileName = "torpedoship_alien_shadow.rmd"
  102. desc.RenderType = ENRENDERTYPE_SHADOW
  103. desc.Material = ENMAT_SHADOW
  104. desc.MaterialColors = units_materialcolors_shadow
  105.  
  106. -- register new unit to logic
  107. unitDesc = logic_getUnitDescP(21)
  108. unitDesc.group = 1
  109. unitDesc.order = 0
  110. unitDesc.unit_res_id = ENET_UNIT_TORPEDOSHIP_ALIEN
  111. unitDesc.unit_icon_id = "Torpedoship_a_small_normal.dds"
  112. unitDesc.active_id = "Torpedoship_a_small_active.dds"
  113. unitDesc.pressed_id = "Torpedoship_a_small_pressed.dds"
  114. unitDesc.small_icon_id = "Torpedoship_l_stats.dds"
  115. unitDesc.big_icon_id = "Torpedoship_a_big_normal.dds"
  116. unitDesc.HP = 5
  117. unitDesc.MP = 30
  118. unitDesc.WR = 2
  119. unitDesc.min_WR = 1
  120. unitDesc.WD = 1
  121. unitDesc.WR2 = 0
  122. unitDesc.min_WR2 = 0
  123. unitDesc.WD2 = 0
  124. unitDesc.ability = 3
  125. unitDesc.transport = 0
  126. unitDesc.value = 2
  127. unitDesc.race = 1
  128. unitDesc.fire_pause = 0.8
  129. unitDesc.move_pause = 1.0
  130. unitDesc.unit_info_scale = 0.04
  131. unitDesc.scn_name = "DESTROYERA"
  132.  
  133. ------------------------------------------------------------------------------------------------------
  134. ------------------------ effects related to unit------------------------------------------------------
  135. ------------------------------------------------------------------------------------------------------
  136.  
  137. function bullets_torpedoalien_fire()
  138.     local bullet = uniGetExecutor()
  139.     bullet:setTransformOwner()
  140.     local sound = bullet:play3DSound("destroyer_alien_torpedo_fly.wav",1)
  141.     local track = bullet:addSimpleEffect(ENET_EFFECT_PS_TORPEDO_WATERTRAY)
  142.     waitDeath(bullet:addMoveEffect(ENET_EFFECT_MOVE_TORPEDOSWIM,100,uniGetTarget()),100)
  143.     sound:destroy()
  144.     track:suspendedDestroy(1.0)
  145.     bullet:play3DSound("destroyer_alien_torpedo_explode.wav",0):destroy()
  146.     bullet:setVisibility(false,true)
  147.     bullet:addSimpleEffect(ENET_EFFECT_LIGHT_ROCKETEXPLODE):delayedDestroy(2.0)
  148.     bullet:addSimpleEffect(ENET_EFFECT_PS_TORPEDOHIT):suspendedDestroy(2.0)
  149.     uniGetTarget():executeCommand(ENC_DAMAGED)
  150.     pause(2.0)
  151.     bullet:destroy()
  152. end
  153.  
  154. registerCommand(ENSCRIPTSET_BULLET_TORPEDO_ALIEN,ENC_FIRE1,"bullets_torpedoalien_fire")
  155.